<template>
	<view class="bg-white flex flex-column" style="height: 94vh;">
		<view class="text-center pt-5 mb-5 font-weight-bold fs-32" style="padding-top: 10vh;">长按保存二维码</view>
		<view class="flex justify-center flex-1">
			<image :src="payImage" mode="widthFix" style="width: 80%;" @click="handleClick"></image>
		</view>
	</view>
</template>

<script>
	import {
		createAlipayMiniQrcode
	} from "@/api/order.js";
	import {
		getOrderDetail
	} from "@/api/order.js";
	export default {
		data() {
			return {
				sn: '',
				type: '',
				payImage: ''
			}
		},
		onLoad(options) {
			this.sn = options.sn;
			this.createAlipayMiniQrcode();
		},
		methods: {
			handleClick() {
				uni.previewImage({
					urls: [this.payImage], // 预览图片数组（支持多张）
					current: this.payImage // 当前预览图片
				});
			},
			async createAlipayMiniQrcode() {
				uni.showLoading({
					title: "加载中",
				});
				createAlipayMiniQrcode({
					url_param: 'pages/order/orderDetail',
					query_param: `sn=${this.sn}&type=pay`,
					describe: '跳转打开订单详情支付'
				}).then((res) => {
					if (res.code == 1) {
						this.payImage = res.data.res.qr_code_url
					}
				}).finally(() => {
					uni.hideLoading()
				});

			}
		}
	}
</script>

<style>

</style>